{% extends "base.html" %}

{% block title %}System Dashboard{% endblock %}

{% block content %}
    <h2>System Status</h2>
    <div class="system-info">
        <p><strong>2RTK Ntrip Caster</strong></p>
        <p><strong>Current Version:</strong> {{ VERSION }}</p>
        <p><strong>Running Port:</strong> {{ NTRIP_PORT }}</p>
        <p><strong>CPU Usage:</strong> {{ cpu_percent }}%</p>
        <p><strong>Memory Usage:</strong> {{ mem_percent }}%</p>
        <p><strong>Uptime:</strong> {{ program_runtime }}</p>
    </div>

    <h2>Active Mount Points</h2>
    <ul>
        {% for mount, start_time in running_mounts %}
        <li>{{ mount }} - Start Time: {{ start_time.strftime('%Y-%m-%d %H:%M:%S') }}</li>
        {% endfor %}
    </ul>

    <h2>Connected Users</h2>
    <ul>
        {% for username, mount, agent, ip, port, auth_time in running_users %}
        <li>User: {{ username }} (IP: {{ ip }}:{{ port }}) - Mount Point: {{ mount }} - Client: {{ agent }} - Authentication Time: {{ auth_time.strftime('%Y-%m-%d %H:%M:%S') }}</li>
        {% endfor %}
    </ul>

    <script>
        setTimeout(function() {
            location.reload();
        }, 30000);
    </script>
{% endblock %}